package simple;

import otherpackage.*;

public class Program {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SimpleDefault sd = new SimpleDefault();
		OtherPackagePublic opd = new OtherPackagePublic();

		System.out.println("I'm public with main. simple.Program");
		System.out.println("\tI have access to " + sd.getClass().getName()
				+ ": " + sd.myDefaultString + " " + sd.myPublicString + " "
				+ sd.myProtectedString);
		System.out.println("\tThru encapsulation I have access to: "
				+ sd.getMyPrivateString());

		System.out.println("\n\tI have access to " + opd.getClass().getName()
				+ ": " + opd.myPublicString);
		System.out.println("\tThru encapsulation I have access to: "
				+ opd.getMyPrivateString());

		ChildDefault cd = new ChildDefault();
		System.out.println(cd.getClass().getName() + " has access to " + cd);
	}

}

class ChildDefault extends OtherPackagePublic {

	@Override
	public String toString() {
		return myProtectedString + " " + myPublicString;
	}

}
